<?php
if(isset($_POST['action'])){
        try {
                //Client opzetten, locatie van WSDL geven.
                $client = new SoapClient("http://127.0.0.1:8080/week2_opdracht5/ThesaurusWSService?wsdl", array( 
                        'trace' => 1,
                    ));
        
                switch ($_POST['action']){
                        case 'getInfo':
                                $kenteken = new stdClass();
                                $kenteken->kenteken = $_POST['PARAMgetInfo0'];
                                //Functie aanroepen. Parameter als assoc. array meegeven
                                $result = $client->getInfo(array(
                                    "arg0"=>$kenteken
                                    ));
                                break;
                }                
        } catch (SoapFault $exception) {
                //Oopz, er is iets mis gegaan
                echo '<pre>';
                echo $exception;
                echo '</pre>';

                print_r(htmlentities($client->__getLastRequest()));  

                exit;
        }
        
        ?>
        <h1>
                Request
        </h1>
        <hr />
        <?php
        
        print_r(htmlentities($client->__getLastRequest()));     
        
        ?>
        <h1>
                Response:
        </h1>
        <hr />
        <?php
        
        echo '<pre>';
        print_r($result);
        echo '</pre>';
}else{
?>
<!DOCTYPE html>
<HTML>
        <HEAD>
                <TITLE>ThesaurusWSService Web Service Tester</TITLE>
        </HEAD>
        <BODY>
                <H1>ThesaurusWSService Web Service Tester</H1>
                <br>
                This form will allow you to test your web service implementation (<A HREF="http://127.0.0.1:8080/week2_opdracht5/ThesaurusWSService?WSDL">WSDL File</A>)
                <hr>To invoke an operation, fill the method parameter(s) input boxes and click on the button labeled with the method name.
                <H3>Methods :</H3>
                <FORM METHOD="POST">public abstract nl.hanze.web.rdw.service.Info com.thesaurus.resource.ThesaurusWS.getInfo(AABB11, AABB22, AABB33)
                        <BR>
                        <INPUT TYPE=SUBMIT NAME=action value=getInfo> (<INPUT TYPE=TEXT NAME=PARAMgetInfo0>)
                        <BR>
                        <HR>
                </FORM>
        </BODY>
</HTML>
<?php
}
?>